<html>
  <head>
    <script type="application/javascript">
      function draw() {
        /** @type {HTMLCanvasElement} */
        let canvas = document.getElementById("canvas");
        let ctx = canvas.getContext("2d");
        ctx.save();
        // 正常情况下
        ctx.font = "48px serif";
        ctx.fillText("Hello world", 10, 50);
        ctx.restore();
        ctx.scale(0.5, 0.5);
        ctx.font = "48px serif";
        ctx.fillText("Hello world", 10, 50);
      }
    </script>
  </head>
  <body onload="draw();">
    <canvas id="canvas" width="500" height="500"></canvas>
  </body>
</html>
<style></style>
